<template>
  <el-button @click="onCreate" class="create" type="danger">
    <el-icon color="#fff">
      <Plus />
    </el-icon>
    创建</el-button>

  <!-- 云模型创建 -->
  <CloudModelCreate v-if="currentRoute === 'CloudModel'" />
  <!-- 知识库创建 -->
  <BaseCread v-if="currentRoute === 'KnowledgeBase' || currentRoute === 'KnowledgeDetails'" />
</template>
<script lang="ts" setup>
import CloudModelCreate from "./components/cloudModelCreate.vue";
import BaseCread from "./components/baseCread.vue";

import { ref, provide, onMounted } from 'vue'
import { useRouter } from "vue-router";
const visible = ref(false)

const route = useRouter();



provide("visible", visible);
const currentRoute = ref<string | symbol>('')
const onCreate = () => {
  currentRoute.value = route.currentRoute.value.name || ''
  visible.value = true
}

onMounted(() => {
  // console.log(route.currentRoute.value.name);
})

</script>

<style lang="scss" scoped>
.create {
  width: 130px;
  height: 40px
}
</style>
